<?php echo $this->load->view('header.php'); ?>
<?php
$items = array();
$i = 0;
foreach ($categories as $c){
	$items[$i] = anchor('photo/main/'.$c->category_id,$c->name, array('class'=>'sideNavItem', 'id'=>$c->category_id));
	$i++;
}
$data['items'] = $items;
echo $this->load->view('body_open.php',$data);
?>

<h3>Upload new photo</h3>

<form action="<?php echo site_url('photo/insert'); ?>" method="post" enctype="multipart/form-data">
<fieldset>
<p><label>Name:</label><input type="text" name="name" /></p>
<p><label>File (just JPEG):</label><input type="file" name="userfile" /></p>
<p><label>Category:</label>
<select name="category_id">
<?php foreach ($categories as $c): ?>
	<option value="<?php echo $c->category_id; ?>"><?php echo $c->name; ?></option>;
<?php endforeach; ?>
</select>
</p>
<p><input type="submit" value="Upload" /></p>
</fieldset>
</form>

<?php if($this->session->flashdata('error')): ?>
<font color="#FF0000" size="+1">
<?php echo $this->session->flashdata('msg'); ?>
</font>
<?php endif; ?>

<?php echo $this->load->view('body_close.php'); ?>